Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sendgrid/client

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sendgrid/client

Twilio SendGrid NodeJS API client

  • 7.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-17.04%
Maintainers
1
Weekly downloads
 
Created

What is @sendgrid/client?

The @sendgrid/client npm package is a JavaScript client for interacting with the SendGrid API. It allows developers to easily integrate SendGrid's email sending capabilities into their applications. The package provides a way to send emails, manage contacts, and perform other email-related tasks programmatically.

What are @sendgrid/client's main functionalities?

Sending Emails

This feature allows you to send emails using the SendGrid API. The code sample demonstrates how to send a simple text email.

const sgClient = require('@sendgrid/client');
sgClient.setApiKey(process.env.SENDGRID_API_KEY);
const request = {
  method: 'POST',
  url: '/v3/mail/send',
  body: {
    personalizations: [{
      to: [{ email: 'recipient@example.com' }],
      subject: 'Hello, World!'
    }],
    from: { email: 'sender@example.com' },
    content: [{ type: 'text/plain', value: 'Hello, World!' }]
  }
};
sgClient.request(request)
  .then(([response, body]) => {
    console.log(response.statusCode);
    console.log(body);
  })
  .catch(error => {
    console.error(error);
  });

Managing Contacts

This feature allows for the management of contacts within SendGrid. The code sample shows how to add a new contact to your SendGrid account.

const sgClient = require('@sendgrid/client');
sgClient.setApiKey(process.env.SENDGRID_API_KEY);
const request = {
  method: 'PUT',
  url: '/v3/marketing/contacts',
  body: {
    contacts: [{
      email: 'newcontact@example.com',
      first_name: 'First',
      last_name: 'Last'
    }]
  }
};
sgClient.request(request)
  .then(([response, body]) => {
    console.log(response.statusCode);
    console.log(body);
  })
  .catch(error => {
    console.error(error);
  });

Other packages similar to @sendgrid/client

FAQs

Package last updated on 18 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc